home *** CD-ROM | disk | FTP | other *** search
- Path: news.umbc.edu!not-for-mail
- From: schlein@umbc.edu (Jonas J. Schlein)
- Newsgroups: comp.lang.c
- Subject: Re: big problem with a very small program:please help me!
- Date: 11 Mar 1996 14:03:29 -0500
- Organization: University of Maryland Baltimore County
- Message-ID: <4i1te1$184@umbc9.umbc.edu>
- References: <4hqc8p$njh@aldebaran.sct.fr>
- NNTP-Posting-Host: umbc9.umbc.edu
- NNTP-Posting-User: schlein
-
- Marc Escalier <escali_m@worldnet.net> wrote:
- |> #include <stdio.h>
- |> #include <math.h>
- |>
- |> main()
- |> {
- |> float i;
- |>
- |> i=5.25;
- |> printf("i is real:l%f\n",i); /* display 5.25000000000000... ok! */
- |> printf("i is integer%d\n",i); /* display 0 what does that mean ?!?*/
-
- But 'i' is not an integer. That should be answer enough. Simply lying to
- printf() won't make anything magical happen except for undefined results.
- You can however place an explicit cast like so:
-
- printf ("i is integer: %d\n", (int) i);
-
- |> return(0);
- |> }
- --
- "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
-
- Jonas J. Schlein (schlein@gl.umbc.edu)
-